function confirmurl(url,message) {
	url = url+'&pc_hash='+pc_hash;
	if(confirm(message)) redirect(url);
}
function redirect(url) {
	location.href = url;
}
//滚动条
$(function(){
	//$(":text").addClass('input-text');
});
function secAdmin(par)
{
	var str = '';
	if(typeof par == 'object'){
		for(var ii in par){
			str += '&'+ii+'='+par[ii];
		}
	}
	window.top.art.dialog({
		id:'selectadmin',
		iframe:'?m=admin&c=admin_manage&a=public_secadmin'+str+'&pc_hash='+pc_hash, 
		title:'人员选择', width:'500', height:'350', lock:true}, 
		function(){
			var d = window.top.art.dialog({id:'selectadmin'}).data.iframe;
			d.selected();return false;
		}, 
		function(){
			window.top.art.dialog({id:'selectadmin'}).close();
		});
	return false;
}
function setAdmin(data)
{
	try{
		window.top.art.dialog({id:'selectadmin'}).close();
		
		
	}catch(ex){
		
	}
}
function secStaff(par)
{
	var str = '';
	if(typeof par == 'object'){
		for(var ii in par){
			str += '&'+ii+'='+par[ii];
		}
	}
	window.top.art.dialog({
		id:'selectstaff',
		iframe:'?m=hr&c=staff&a=boxselect'+str+'&pc_hash='+pc_hash, 
		title:'员工选择', width:'800', height:'350', lock:true}, 
		function(){
			var d = window.top.art.dialog({id:'selectstaff'}).data.iframe;
			d.selected();return false;
		}, 
		function(){
			window.top.art.dialog({id:'selectstaff'}).close();
		});
	return false;
}
function setStaff(data)
{
	try{
		window.top.art.dialog({id:'selectstaff'}).close();
		var staff = data[0];
		for(var i in staff){
			$('#s_'+i).text(staff[i]);
			$('#i_'+i).val(staff[i]);			
		}
		
	}catch(ex){
		
	}
}
function llog(m)
{
	console.log(m);
}
function digit_uppercase(n) 
{
	if(n.length>0)n = n.replace(/[^\d\.]/g,'');
	if(n.length<1)return '';
	var fraction = ['角', '分'];
	var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
	var unit = [ ['元', '万', '亿'], ['', '拾', '佰', '仟']  ];
	var head = n < 0? '欠': '';
	n = Math.abs(n);

	var s = '';
	
	for (var i = 0; i < fraction.length; i++) 
	{
		//llog(n * 10 * Math.pow(10, i));
		s += (digit[Math.round(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
	}
	s = s || '整';
	n = Math.floor(n);

	for (var i = 0; i < unit[0].length && n > 0; i++) 
	{
		var p = '';
		for (var j = 0; j < unit[1].length && n > 0; j++) 
		{
			p = digit[n % 10] + unit[1][j] + p;
			n = Math.floor(n / 10);
		}
		s = p.replace(/(零.)*零$/, '').replace(/^$/, '零')  + unit[0][i] + s;
	}
	return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
}
/**
 * 全选checkbox,注意：标识checkbox id固定为为check_box
 * @param string name 列表check名称,如 uid[]
 */
function selectall(name) {
	if ($("#check_box").attr("checked")=='checked') {
		$("input[name='"+name+"']").each(function() {
  			$(this).attr("checked","checked");
			
		});
	} else {
		$("input[name='"+name+"']").each(function() {
  			$(this).removeAttr("checked");
		});
	}
}
function openwinx(url,name,w,h) {
	if(!w) w=screen.width-4;
	if(!h) h=screen.height-95;
	url = url+'&pc_hash='+pc_hash;
    window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
}
//弹出对话框
function omnipotent(id,linkurl,title,close_type,w,h) {
	if(!w) w=700;
	if(!h) h=500;
	art.dialog({id:id,iframe:linkurl, title:title, width:w, height:h, lock:true},
	function(){
		if(close_type==1) {
			art.dialog({id:id}).close()
		} else {
			var d = art.dialog({id:id}).data.iframe;
			var form = d.document.getElementById('dosubmit');form.click();
		}
		return false;
	},
	function(){
			art.dialog({id:id}).close()
	});void(0);
}